class SweetPotato():

    def __init__(self):
        self.cook_time = 0
        self.cook_state = '生的'
        self.cook_condiments = []

    def cook(self,time):
        self.cook_time += time
        if 0 <= self.cook_time < 3:
            self.cook_state = '生的'
        elif 3 <= self.cook_time < 5:
            self.cook_state = '半生不熟'
        elif 5 <= self.cook_time < 8:
            self.cook_state = '熟了'
        elif 8 <= self.cook_time:
            self.cook_state = '糊了'

    def addCondiments(self,condiment):
        self.cook_condiments.append(condiment)


    def __str__(self):
        return f"这个地瓜被烤的时间是{self.cook_time}分钟,现在的状态时{self.cook_state},添加的调料是{self.cook_condiments}"


digua1 = SweetPotato()

# print(digua1)
#
# digua1.cook(2)
# print(digua1)




digua1.cook(3)
digua1.addCondiments("胡椒粉")
print(digua1)

digua1.cook_time = 0
digua1.cook_condiments=[]

digua1.cook(5)
digua1.addCondiments("辣椒酱")
print(digua1)